// Describe: 获取内存信息图
package cmd

import (
	"context"
	"github.com/rs/zerolog/log"
	"github.com/spf13/cobra"
	"wormhole/pkg/clientx"
	"wormhole/protos/hole"
)

var snapshotCmd = &cobra.Command{
	Use:     "snapshot",
	Aliases: []string{""},
	Short:   "设置环境参数",
	Long:    `use like: wormhole set self_name=new_wormhole`,
	Run: func(cmd *cobra.Command, args []string) {
		c, err := clientx.NewLocalClient()
		if err != nil {
			return
		}
		defer c.Close()
		_, err = c.Snapshot(context.Background(), new(hole.Empty))
		if err != nil {
			log.Error().Msg("服务端未启动")
		}
	},
}

func init() {
	rootCmd.AddCommand(snapshotCmd)
}
